﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace nGSO.Tests
{
    [TestFixture]
    public class DefaultNeighboursLocalizatorTest
    {
        [Test(Description="Selecting only neighbour in agent range and with luminescence higher than agnet")]
        public void SimpleDistanceAssertion()
        {
            DefaultNeighboursLocalizator localizatior = new DefaultNeighboursLocalizator();
            
            Agent agent = new Agent() { Loc = new double[] { 1.5, 1.5}, Luciferin = 1, NeighborhoodRange =  1};

            Agent neighbour1 = new Agent() { Loc = new double[] { 2, 2 }, Luciferin = 3, NeighborhoodRange = 1 };
            Agent neighbour2 = new Agent() { Loc = new double[] { 2, 2 }, Luciferin = 2, NeighborhoodRange = 1 };
            Agent neighbour3 = new Agent() { Loc = new double[] { 5, 5 }, Luciferin = 3, NeighborhoodRange = 1 };
            Agent neighbour4 = new Agent() { Loc = new double[] { 2, 2 }, Luciferin = 1, NeighborhoodRange = 1 };

            List<Agent> neighbours = new List<Agent>();
            neighbours.Add(neighbour1);
            neighbours.Add(neighbour2);
            neighbours.Add(neighbour3);

            localizatior.SetAgentNeighbors(agent, neighbours, 2);

            Assert.IsTrue(agent.Neighbors.Contains(neighbour1));
            Assert.IsTrue(agent.Neighbors.Contains(neighbour2));
            Assert.IsFalse(agent.Neighbors.Contains(neighbour3));
            Assert.IsFalse(agent.Neighbors.Contains(neighbour4));
        }
    }
}
